import requests


class IhrmParmentApi:
    @classmethod
    def par_add_api(cls, token, body):
        url = "http://ihrm2-test.itheima.net/api/company/department"
        header = {"Content-Type": "application/json", "Authorization": token}
        resp = requests.post(url=url, headers=header, json=body)
        return resp

    @classmethod
    def par_sel_api(cls, emp_id, token):
        url = 'http://ihrm2-test.itheima.net/api/company/department/' + emp_id
        header = {"Content-Type": "application/json", "Authorization": token}
        resp = requests.get(url=url, headers=header)
        return resp

    @classmethod
    def par_upd_api(cls, emp_id, token, body):
        url = "http://ihrm2-test.itheima.net/api/company/department/" + emp_id
        header = {"Content-Type": "application/json", "Authorization": token}
        resp = requests.put(url=url, headers=header, json=body)
        return resp

    @classmethod
    def par_del_api(cls, emp_id, token):
        # url = 'http://ihrm2-test.itheima.net/api/company/department/' + emp_id
        # header = {"Authorization": token}
        # resp = requests.delete(url=url, headers=header)
        # return resp

        url = 'http://ihrm2-test.itheima.net/api/company/department/' + emp_id
        header = {"Authorization": token}
        resp = requests.get(url=url, headers=header)
        return resp


if __name__ == '__main__':
    token = "e873d86c-b106-4e29-9157-acd7b322b288"
    emp_id = "1553373783551766528"
    print(IhrmParmentApi.par_del_api(token, emp_id))
